
package testmysql;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.exofire.is3ong.*;



public class Main
{
   static String login = "root";
   static String password = "root";
   static String url = "jdbc:mysql://localhost";
   static String nombre_bd = "ong";

   public static void main(String[] args)
   {
      AccessMysql bd;
      int procResult;
      
      //Connection conn = null;
      try
      {
          bd = new AccessMysql (url, nombre_bd, login, password);
          if (bd != null) {
            //bd.procedureAltaPersonal("11111111B", "Wesley", "Sneidjer", "Holanda", "NULL", "NULL");
            //bd.procedureBuscarPersonalDNI("11111111B");
            //bd.procedureBuscarPersonalNombre("Wesley");  
            //bd.procedureBajaPersonal("11111111A");
            //bd.procedureEditarPersonal("11111111B", "11111111A", "San", "Iker", "Casillas", "0034123459999");
            // bd.procedureCrearTarea(1, "Tarea1", "Prueba de tarea", 100);
              bd.procedureEditarTarea(1, "Tarea_modificada", "Tarea_mod", 2000);
              
            procResult = bd.getResultProcedure();
            System.out.println("Resultado procedimiento: " + procResult);
          }
      }
      catch (Exception ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
      }          
//      catch (InstantiationException ex) {
//            Logger.getLogger(AccessMysql.class.getName()).log(Level.SEVERE, null, ex);
//      } catch (IllegalAccessException ex) {
//            Logger.getLogger(AccessMysql.class.getName()).log(Level.SEVERE, null, ex);
//      } catch (SQLException ex) {
//            Logger.getLogger(AccessMysql.class.getName()).log(Level.SEVERE, null, ex);
//      } catch (ClassNotFoundException ex) {
//            Logger.getLogger(AccessMysql.class.getName()).log(Level.SEVERE, null, ex);
//      }  
          
//            Statement stmt = conn.createStatement();
//            ResultSet res  = stmt.executeQuery("SELECT * FROM contactos");

//            System.out.println("\nNOMBRE \t\t EMAIL \t\t\t TELEFONO \n");

//            while(res.next())
//            {
//               String nombre  = res.getString("nombre");
//               String email   = res.getString("email");
//               String telefono= res.getString("telefono");
//
//               System.out.println(nombre +" \t "+email+" \t "+telefono);
//            }
            
//            res.close();
//            stmt.close();
//            conn.close();

   }
}
